import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)

export default new Vuex.Store({
    //持久化
    plugins: [createPersistedState()],

    state: {
        userInfo: null, // 用户信息 判断是否登录 
        city: null, // 当前的城市信息 
        cityList: [] //中国所有的城市信息
    },
    mutations: {
        changeUserInfo(state, payload) {
            state.userInfo = payload;
        },
        changeCity(state, payload) {
            state.city = payload
        },
        changeCityList(state, payload) {
            state.cityList = payload
        },

    },
    actions: {},
    modules: {}
})